/*
 * @Descripttion:
 * @version:
 * @Author: charchen
 * @Date: 2021-07-27 09:56:27
 * @LastEditors: charchen
 * @LastEditTime: 2021-08-12 15:14:38
 */
/**
 * Author：Sam
 * Date: 21.7.26
 * Description: Sku选择器接口
 */
import { request } from "@xiaoe/js-tools/lib/request";

//定义直播前缀
var alivePrefix = ""
function changeLivePrefix(data){
  alivePrefix = data
}

// 获取商品详情基本信息
const  getBaseInfo = params =>  {
  return request({
    url: `${alivePrefix}/xe.ecommerce.goods_center.get_spu_info/1.0.0`,
    params,
  })
}

// 商品的sku的所有属性以及每个属性的所有值
const getSkuProperty = params => {
  return request({
    url: `${alivePrefix}/xe.ecommerce.goods_center.get_attr_list/1.0.0`,
    params
  })
}

// 商品SKU列表
const getSkuList = params => {
  return request({
    url: `${alivePrefix}/xe.ecommerce.goods_center.get_sku_list/1.0.0`,
    params
  })
}

// 营销信息接口
const getMarketing = params => {
  return request({
    url: `${alivePrefix}/xe.marketing.basic.activity.info/1.0.0`,
    params
  })
}

// 获取历史限购订单
const getLimitBuyOrder = (params) => {
  return request({
    url: `${alivePrefix}/xe.transaction.user.has_buy/1.0.0`,
    params
  })
}
// 超级会员信息
const getSuperVipInfo = data => {
  return request({
    url: `${alivePrefix}/xe.svip.info.get_by_resource.detail/1.0.0`,
    params: data
  })
}

// 组合商品规格所内涵的商品
const getChildSku = data => {
  return request({
    url: `/xe.ecommerce.goods_detail.c.cop_child_sku_abnormal.check/1.0.0`,
    params: data,
    pack: '',
    requestType: 'json'
  })
}

// 店铺小程序组合商品SKU列表
const getCopWxMiniSkuList = params => {
  return request({
    url: `/xe.ecommerce.goods_detail.c.little_program_cop_sku.list/1.0.0`,
    params,
    pack: '',
    requestType: 'json'
  })
}

// 超级会员体验规格查询
const getVipSpecification = data => {
  return request({
    url: `/xe.svip.c.specification_list.get/1.0.0`,
    params: data,
    pack: '',
  })
}


export {
  getBaseInfo,
  getSkuList,
  getSkuProperty,
  getMarketing,
  getLimitBuyOrder,
  changeLivePrefix,
  getSuperVipInfo,
  getChildSku,
  getCopWxMiniSkuList,
  getVipSpecification
}
